﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RayTracing
{
    public partial class AnimationPropertiesForm : Form
    {
        public AnimationPropertiesForm()
        {
            InitializeComponent();
            trackBarAnim.Minimum = 0;
            trackBarAnim.Maximum = Main.animationParamaters.totalFrames;
            trackBarAnim.TickFrequency = Main.animationParamaters.totalFrames;
            trackBarAnim.LargeChange = 1;
            trackBarAnim.SmallChange = 1;
            
        }

        private void buttonAnimPlay_Click(object sender, EventArgs e)
        {
            Main.moviePlay = true;
            trackBarAnim.Value = Main.movieFrame;
        }

        private void buttonAnimPause_Click(object sender, EventArgs e)
        {
            Main.moviePlay = false;
        }

        private void buttonAnimReverse_Click(object sender, EventArgs e)
        {
            Main.movieFrame -= 2;
        }

        private void buttonAnimForward_Click(object sender, EventArgs e)
        {
            Main.movieFrame += 1;
        }

        private void trackBarAnim_ValueChanged(object sender, EventArgs e)
        {
            Main.movieFrame = trackBarAnim.Value;
            Main.movieTrackBarChanged = true;
        }
        int read;
        private void buttonEnter_Click(object sender, EventArgs e)
        {
            try
            {
                 read = int.Parse(textBox1.Text);
            }
            catch (Exception exept)
            {
                Console.WriteLine(exept.Message);
                read = 21;
            }
            Main.animationParamaters.totalFrames = read;
        }
    }
}
